package cn.kgm.sqlSession;

import cn.kgm.executor.Executor;
import cn.kgm.executor.SimpleExecutor;
import cn.kgm.pojo.Configuration;

public class DefaultSqlSessionFactory implements SqlSessionFactory {

    private Configuration configuration;

    public DefaultSqlSessionFactory(Configuration configuration) {
        this.configuration = configuration;
    }

    @Override
    public SqlSession openSqlSession() {
        // 1,创建执行器对象(他的里面有真正去执行jdbc接口的信息)
        Executor simpleExecutor = new SimpleExecutor();
        // 2,生产sqlSession对象
        SqlSession defaultSqlSession = new DefaultSqlSession(configuration, simpleExecutor);
        return defaultSqlSession;
    }
}
